{% extends "base.html" %}
{% block title %}Tester's&nbsp;Paradise{% endblock%}
{% block css %}/static/styles/pages/detail.css{% endblock%}
{% block header %}
<script src="/static/js/jquery.js"></script>

<header class="header">
    <div class="header-cont">
        <a href="/" class="navbar-brand"><b>Tester's&nbsp;Paradise</b></a>
        <ul class="ant-menu ant-menu-light ant-menu-root ant-menu-horizontal" role="menu">
            {% if type == "video" %}
            <li class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-submenu-selected" role="menuitem">{% else
                %}
            <li class="ant-menu-submenu ant-menu-submenu-horizontal" role="menuitem">{% endif %}
                <div class="ant-menu-submenu-title" aria-expanded="false" aria-haspopup="true">
                    <a href="/sum/?type=video"><span class="ant-badge">视频测试结果</span>
                        <i class="ant-menu-submenu-arrow"></i></a>
                </div>
            </li>
            {% if type == "interface" %}
            <li class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-submenu-selected" role="menuitem">{% else
                %}
            <li class="ant-menu-submenu ant-menu-submenu-horizontal" role="menuitem">{% endif %}
                <div class="ant-menu-submenu-title" aria-expanded="false" aria-haspopup="true">
                    <a href="/sum/?type=interface"><span class="ant-badge">接口测试结果</span>
                        <i class="ant-menu-submenu-arrow"></i></a>
                </div>
            </li>

        </ul>
    </div>
</header>
{% endblock %}
{% block content %}
<script src="/static/js/test.js"></script>

<div class="page-main clearfix">
    <div style="justify-content: space-between; display: flex;">
        <p class="subtitle-summary">{% if type == "video" %}视频{% elif type == "interface" %}接口{% endif %}测试结果详情</p>
        <span class="verify_select">
            <select id="TypeId" class="select_result_type" style="height:36px; width:180px; background:white; color:grey;">
                <option>- 请选择测试结果类型 -</option>
                {% if condition == "1" %}<option value="1" selected="selected">通过</option>{% else %}<option value="1" >通过</option>{% endif %}
                {% if condition == "0" %}<option value="2" selected="selected">不通过</option>{% else %}<option value="2">不通过</option>{% endif %}
                {% if condition == "-1" %}<option value="3" selected="selected">未知</option>{% else %}<option value="3">未知</option>{% endif %}
            </select>
            {% if condition != "" %}
            <button id="select-{{ page }}" value="" onclick="selectEvents('{{ type }}', {{ sum_id }})" type="button" class="ant-btn ant-btn-primary" style="height:36px; width:59px; border-radius:6px; border:1px solid #a9a9a9; margin-left:4px; background:white;"><span>查 询</span></button>
            {% else %}
            <button id="select-{{ page }}" value="{{ condition }}" onclick="selectEvents('{{ type }}', {{ sum_id }})" type="button" class="ant-btn ant-btn-primary" style="height:36px; width:59px; border-radius:6px; border:1px solid #a9a9a9; margin-left:4px; background:white;"><span>查 询</span></button>
            {% endif %}
        </span>
    </div>
    <table>
        <thead class="ant-table-thead">
        <tr>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">序号</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">测试时间</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">事件类型</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">测试用例视频</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">视频视频</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">事件图片</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">预期结果</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">实际结果</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">测试结果</span><span
                    class="ant-table-column-sorter"></span></div></span></th>

        </tr>
        </thead>
        <tbody class="ant-table-tbody">
        {% for each in pagination_instance.items %}
        <tr class="ant-table-row ant-table-row-level-0" data-row-key="50000">
            <td class="" style="text-align: center;">{{ each.id }}</td>
            <td class="" style="text-align: center;">{{ each.result_video_sum.test_datetime }}</td>

            {% if each.config_event_type.name == None %}
            <td class="" style="text-align: center;"></td>
            {% else %}
            <td class="" style="text-align: center;">{{ each.config_event_type.name }}</td>
            {% endif %}

            {% if each.test_video_url == None %}
            <td class="" style="text-align: center;">无</td>
            {% else %}
            <td class="" style="text-align: center;"><a href="{{ each.test_video_url }}">查看</a></td>
            {% endif %}

            {% if each.event_video_url == None %}
            <td class="" style="text-align: center;">无</td>
            {% else %}
            <td class="" style="text-align: center;"><a href="{{ each.event_video_url }}">查看</a></td>
            {% endif %}

            {% if each.event_image_url == None %}
            <td class="" style="text-align: center;">无</td>
            {% else %}
            <td class="" style="text-align: center;"><a href="{{ each.event_image_url }}">查看</a></td>
            {% endif %}

            <td class="" style="text-align: center;">{{ each.expect_result }}</td>
            <td class="" style="text-align: center;">{{ each.actual_result }}</td>
            <td class="" style="text-align: center;">
                <div style="width: 15px; height: 15px; border-radius: 50%; background: {% if each.test_result == 1 %} green {% else %} red {% endif %}; margin: auto;"></div>
            </td>

        </tr>
        </tbody>
        {% endfor %}
    </table>

    <ul class="ant-pagination ant-table-pagination">
        <li title="返回" class="ant-pagination-disabled ant-pagination-prev" aria-disabled="true"
            style="height:36px; width:59px; border-radius:6px; vertical-align: middle;"><a href="/sum/?type={{ type }}" class="ant-pagination-item-link">返 回</a>
        </li>

        {% if pagination_instance.has_prev %}
        <li title="上1页" class="ant-pagination-disabled ant-pagination-prev" aria-disabled="true"><a
                href="/detail/?type={{ type }}&sum_id={{ sum_id }}&page={{ pagination_instance.prev_num }}&condition={{ condition }}"
                class="ant-pagination-item-link"><</a></li>
        {% endif %}

        {% for each in pages %}
        {% if each != None %}
        {% if each == page %}
        <li title="{{ each }}" class="ant-pagination-item ant-pagination-item-{{ each }} ant-pagination-item-active"
            tabindex="0"><a href="/detail/?type={{ type }}&sum_id={{ sum_id }}&page={{ each }}&condition={{ condition }}">{{ each }}</a></li>
        {% else %}
        <li title="{{ each }}" class="ant-pagination-item ant-pagination-item-{{ each }}" tabindex="0"><a
                href="/detail/?type={{ type }}&sum_id={{ sum_id }}&page={{ each }}&condition={{ condition }}">{{ each }}</a></li>
        {% endif %}
        {% else %}
        <li title="更多" tabindex="0" class="ant-pagination-jump-next ant-pagination-jump-next-custom-icon">
            <span class="ant-pagination-item-ellipsis" onclick="pageTurn({{ page }}, '{{ pages.index(page) < loop.index0 }}', {{ pagination_instance.pages }}, {{ sum_id }}, '{{ type }}')">&hellip;</span>
        </li>
        {% endif %}
        {% endfor %}

        {% if pagination_instance.has_next %}
        <li title="下1页" class="ant-pagination-disabled ant-pagination-prev" aria-disabled="true"><a
                href="/detail/?type={{ type }}&sum_id={{ sum_id }}&page={{ pagination_instance.next_num }}&condition={{ condition }}"
                class="ant-pagination-item-link">></a></li>
        {% endif %}

    </ul>
</div>
{% endblock%}

{% block remark %}
<footer class="footer">
    <div class="footer-cont">
        <p>注意事项：预期结果和实际结果中的数值含义：-1表示没有事件发生，2表示事件状态为未处理，4表示事件状态为自动确认。</p>
    </div>
</footer>
{% endblock %}